<?php
/**
 * Groups module for XOOPS
 *
 * You may not change or alter any portion of this comment or credits
 * of supporting developers from this source code or any supporting source code 
 * which is considered copyrighted (c) material of the original comment or credit authors.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @copyright       The Groups Project http://code.google.com/p/groupsforxoops/
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package         groups
 * @since           2.3.0
 * @author          Hui Xiao < xh.8326@gmail.com >
 * @version         $Id: form.us.groups.edit.php Sat Jul 18 12:47:57 CST 2009
 */

if (false === defined("XOOPS_ROOT_PATH")) {	exit();}



$form = new XoopsForm("", "form", $formUrl, "post",true);
$form->setExtra("enctype=\"multipart/form-data\"");

$category_handler = xoops_getmodulehandler("category","groups");

/** 分类群组数 */
$_categories = $category_handler->getCategories();

/** 加载搜索form */
$_cat = array();
if ( $_categories ) {
    foreach ( $_categories as $k=>$cat ) {
        $_cat[$cat["cat_id"]] = $cat["cat_name"]."({$cat["cat_groups"]})";
    }
}

$cat_id = new XoopsFormSelect(_GP_FORM_CATEGORIES,"cat_id",$groups_arr["cat_id"]);
$cat_id->addOption("0",_GP_SEARCH_SELECT_CATEGORY);
$cat_id->addOptionArray($_cat);
$form->addElement($cat_id,true);

if ( !empty($groups_arr["group_logo"]) ) {
	$form->addElement( new XoopsFormLabel(_GP_FORM_GROUP_OLDLOGO,"<img src=\"".XOOPS_UPLOAD_URL."/{$groups_arr["group_logo"]}\" />"._GP_FORM_GROUP_LOGODESC,"tbumb") );
}
$form->addElement( new XoopsFormFile(_GP_FORM_GROUP_LOGO,"group_logo",1024*1024));
$form->addElement( new XoopsFormText(_GP_FORM_GROUP_NAME, "group_name",24,255,$groups_arr["group_name"]),true);
$form->addElement( new XoopsFormTextArea(_GP_FORM_GROUP_DESC,"group_description",$groups_arr["group_description"],8),true);
$form->addElement( new XoopsFormTextArea(_GP_FORM_GROUP_NOTICE,"group_notice",$groups_arr["group_notice"],8));

$form->addElement(new XoopsFormHidden("ac","savegroup"));
$form->addElement(new XoopsFormHidden("group_id",$groups_arr["group_id"]));
$form->addElement(new XoopsFormButton("","submit",_SUBMIT,"submit"));
$form->assign($xoopsTpl);